package com.ruibang.glass.quality.controller.manage;

import com.ruibang.glass.quality.domain.req.InspectionDefectStatisticsRuleReq;
import com.ruibang.glass.quality.entity.InspectionDefectStatisticsRule;
import com.ruibang.glass.quality.service.InspectionDefectStatisticsRuleService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @Author: songJinKang
 * @CreateTime: 2024-02-23  14:17
 * @Description: TODO
 * @Version: 1.0
 */

@RestController
@RequestMapping("/api/quality/manage/inspectionDefectStatisticsRule")
@Api(value = "复检缺陷统计规则控制器", tags = {"复检缺陷统计规则控制器"})
public class InspectionDefectStatisticsRuleController {

    @Autowired
    private InspectionDefectStatisticsRuleService inspectionDefectStatisticsRuleService;

    @PostMapping("/save")
    @ApiOperation(value = "保存规则", notes = "保存规则")
    public ResultBody save(@RequestBody @Valid List<InspectionDefectStatisticsRuleReq> inspectionDefectStatisticsRuleReq) {
        inspectionDefectStatisticsRuleService.insert(inspectionDefectStatisticsRuleReq);
        return ResultBody.success();
    }

    @GetMapping("/getRule")
    @ApiOperation(value = "获取规则", notes = "获取规则")
    public ResultBody save() {
        return ResultBody.success(inspectionDefectStatisticsRuleService.getRule());
    }


}
